-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
working solution #1204
base: master
Are you sure you want to change the base?
working solution #1204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good progress 👍
But you need to fix all tests
src/App.tsx
Outdated
> | ||
Something went wrong! | ||
</div> | ||
const isShowPostsBlock = currentUser && !isPostsError && !isPostsLoading; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isShowPostsBlock = currentUser && !isPostsError && !isPostsLoading; | |
const isPostsBlockShown = currentUser && !isPostsError && !isPostsLoading; |
src/App.tsx
Outdated
<UserSelector /> | ||
</div> | ||
export const App: React.FC = () => { | ||
const [isShowForm, setIsShowForm] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [isShowForm, setIsShowForm] = useState(false); | |
const [isFormShown, setIsFormShown] = useState(false); |
src/App.tsx
Outdated
)} | ||
|
||
{isShowPostsBlock && | ||
(posts.length === 0 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(posts.length === 0 ? ( | |
(!posts.length ? ( |
src/components/PostDetails.tsx
Outdated
delete button | ||
</button> | ||
</div> | ||
{isShowCommentsBlock && comments.length === 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create variable
src/components/PostDetails.tsx
Outdated
{'Multi\nline\ncomment'} | ||
</div> | ||
</article> | ||
{isShowCommentsBlock && comments.length !== 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create variable
src/hooks/useComments.ts
Outdated
try { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here
src/hooks/useComments.ts
Outdated
try { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
src/hooks/usePosts.ts
Outdated
try { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
src/hooks/useUsers.ts
Outdated
} finally { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless finally
src/hooks/useUsers.ts
Outdated
|
||
setUsers(usersFromServer); | ||
} catch { | ||
throw new Error('Unable to load users'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not throw an error inside catch
I couldn’t pass two tests: ‘should not request posts from API’ and ‘should not request comments from API’, even though the application is working as intended. The other tests was passed ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me🔥
DEMO LINK